package scriptrunner.execution.parameter;

import java.io.Serializable;
import java.util.Map;
import java.util.Map.Entry;

public class HttpParameter implements Parameter<String> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1121152868119839503L;
	
	private Map<String, String> parameters;
	
	public HttpParameter(Map<String, String> parameters) {
		this.parameters = parameters;
	}

	@Override
	public String getParameterValue(String name) {
		return parameters.get(name);
	}

	@Override
	public Map<String, String> getParameters() {
		return parameters;
	}
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("{");
		for(Entry<String, String> entry : parameters.entrySet()) {
			sb.append(entry.getKey() + "=" + entry.getValue() + ",");
		}
		sb.append("}");
		return sb.toString();
	}
}
